{% extends 'base/base.html' %}
{% load static %}
{% block title %}在线课堂{% endblock %}
{% block link %}
    <link rel="stylesheet" href="{% static 'css/course/course.css' %}">
    <script>
        iMenuIndex = 1
    </script>
{% endblock %}
{% block header %}
<header id="header">
  <div class="mw1200 header-contain clearfix">
    <!-- logo start -->
    <h1 class="logo">
      <a href="javascript:void(0);" class="logo-title">Python</a>
    </h1>
    <!-- logo end -->
    <!-- nav start -->
    <nav class="nav">
      <ul class="menu">
        <li><a href="{% url "course:index" %}">课件包</a></li>
      </ul>
    </nav>
    <!-- nav end -->
    <!-- login start -->
      <div class="login-box">
          {% if user.is_authenticated %}
              <div class="author">
                    <i class="PyWhich py-user"></i>
                    <span>{{ user.username }}</span>
                    <ul class="author-menu">
                        <li><a href="{% url 'myadmin:index' %}">后台管理</a></li>
                        <li><a href="{% url 'user:logout' %}">退出登录</a></li>
                    </ul>
                </div>
            {% else %}
                <div>
                    <i class="PyWhich py-user"></i>
                    <span>
                    <a href="{% url 'user:login' %}" class="login">登录</a> / <a href="{% url 'user:register' %}"
                                                                             class="reg">注册</a>
              </span>
                </div>
            {% endif %}
      </div>
    <!-- login end -->
  </div>
</header>

{% endblock header %}





{% block main_start %}
{#     <nav class="nav">#}
{#      <ul class="menu">#}
{#        <li><a href="">在线课堂</a></li>#}
{#      </ul>#}
{#    </nav>#}
    <main id="course-container">
        <div class="w1200">
            <ul class="course-list">
                {% for course in courses %}
                <li class="course-item">
                    <a href="{% url 'course:course_detail' course.id %}">
                        <img class="course-img" src="{{ course.cover_url }}"
                             alt="{{ course.title }}">
                        <div class="course-content">
                            <p class="course-info">{{ course.title }}</p>
                            <p class="course-author">{{ course.teacher.name }}({{ course.teacher.title }})</p>
                            <p class="course-price free">免费</p>
                        </div>
                    </a>
                </li>
                {% endfor %}

            </ul>
        </div>
    </main>
{% endblock %}

